package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.DeviceStatus;
import com.ruoyi.system.mapper.DeviceStatusMapper;
import com.ruoyi.system.service.IDeviceStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备状态模块Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-19
 */
@Service
public class DeviceStatusServiceImpl implements IDeviceStatusService {
    @Autowired
    private DeviceStatusMapper deviceStatusMapper;

    /**
     * 查询设备状态模块
     *
     * @param deviceId 设备状态模块主键
     * @return 设备状态模块
     */
    @Override
    public DeviceStatus selectDeviceStatusByDeviceId(String deviceId) {
        return deviceStatusMapper.selectDeviceStatusByDeviceId(deviceId);
    }

    /**
     * 查询设备状态模块列表
     *
     * @param deviceStatus 设备状态模块
     * @return 设备状态模块
     */
    @Override
    public List<DeviceStatus> selectDeviceStatusList(DeviceStatus deviceStatus) {
        return deviceStatusMapper.selectDeviceStatusList(deviceStatus);
    }

    /**
     * 新增设备状态模块
     *
     * @param deviceStatus 设备状态模块
     * @return 结果
     */
    @Override
    public int insertDeviceStatus(DeviceStatus deviceStatus) {
        deviceStatus.setCreateTime(DateUtils.getNowDate());
        return deviceStatusMapper.insertDeviceStatus(deviceStatus);
    }

    /**
     * 修改设备状态模块
     *
     * @param deviceStatus 设备状态模块
     * @return 结果
     */
    @Override
    public int updateDeviceStatus(DeviceStatus deviceStatus) {
        deviceStatus.setUpdateTime(DateUtils.getNowDate());
        return deviceStatusMapper.updateDeviceStatus(deviceStatus);
    }

    /**
     * 批量删除设备状态模块
     *
     * @param deviceIds 需要删除的设备状态模块主键
     * @return 结果
     */
    @Override
    public int deleteDeviceStatusByDeviceIds(String[] deviceIds) {
        return deviceStatusMapper.deleteDeviceStatusByDeviceIds(deviceIds);
    }

    /**
     * 删除设备状态模块信息
     *
     * @param deviceId 设备状态模块主键
     * @return 结果
     */
    @Override
    public int deleteDeviceStatusByDeviceId(String deviceId) {
        return deviceStatusMapper.deleteDeviceStatusByDeviceId(deviceId);
    }
}
